using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

using BuildingBasicDomain;
using MVCFramework.Models;
//using BuildingStructuralElements;
using CommonTypes;
//using BuildingGrid;


namespace MVCFramework.View
{
    /*
    class WriterVisitor:IVisitor 
    {
       StreamWriter sw ;
        public WriterVisitor()
        {

        }



        public void Visit(object element)
        {
            if (element is Grid)
                Visit(element as Grid);
            if (element is GridLine )
               Visit (element as GridLine );
            if (element is IModel )
                Visit (element as IModel );
            if (element is Beam)
                Visit(element as Beam);

        }
 
        private   void Visit(Grid grid)
        {

            foreach (GridPoint p in grid.GridPoints)
            {
                sw.WriteLine(p.ToString());
            }
            WriteLines(grid.GridLines1);
            WriteLines(grid.GridLines2);
            WriteLines(grid.GridLines3);
        }



        private void WriteLines(GridLine[, ,] lines)
        {
            if (lines == null) return;
            foreach (GridLine _line in lines)
            {
                

                if (_line != null)
                {
                    sw.WriteLine(_line.ToString());
                }
      
            }
        }



        private void Visit(IModel constraction)
        {
            sw = File.CreateText("TestWriterVisitor.txt");
            sw.WriteLine("Test Document ");
            sw.WriteLine(" -----------Grid------------------");
            Visit(constraction.GetGroup ("Grids")[0]);

            sw.WriteLine(" -----------Beams------------------");
            foreach (Beam beam in constraction.GetGroup("Beams"))
                Visit(beam);
            foreach (Slab slab1 in constraction.GetGroup("Slabs"))
                Visit(slab1);


            sw.Close();
        }


        private void Visit(Beam beam)
        {
            sw.WriteLine(beam.ToString());
            
        }


        private void Visit(Slab slab1)
        {

            foreach (Node node in slab1)
                sw.WriteLine(node.ToString());

        }
    }
    */
}
